package 蓝桥杯;

import java.util.Scanner;

public class ackuerman {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int m=sc.nextInt();
        int n=sc.nextInt();
        System.out.println(ack(m,n));
    }

    public static int ack(int m,int n){
        if(m==0){
            return n+1;
        }else if(m>0 && n==0){
            return ack(m-1,1);
        }else{
            return ack(m-1,ack(m,n-1));
        }
    }
}